export function objectToFormData(obj: any, formData = new FormData(), parentKey: any) {
    for (const key in obj) {
        if (obj.hasOwnProperty(key)) {
            const propName = parentKey ? `${parentKey}[${key}]` : key;

            if (obj[key] instanceof File || obj[key] instanceof Blob) {
                formData.append(propName, obj[key]);
            } else if (typeof obj[key] === 'object' && obj[key] !== null) {
                // 递归处理嵌套对象
                objectToFormData(obj[key], formData, propName);
            } else {
                // 处理基本类型值
                formData.append(propName, obj[key]);
            }
        }
    }
    return formData;
}
